<?php
namespace App\Service\BMR\Metabolize;
/**
 * 人类基础代谢计算
 */
class BasialMetabolize implements Metabolize {
    //总热量系数
    public static $totalRitio = 0.7;

    public function baseStatistic(Person $person)
    {
//        var_dump(
//            $person->baseHot,
//            $person->weightRatio,
//            $person->weight,
//            $person->heightRatio,
//            $person->height,
//            $person->ageRatio,
//            $person->age
//        );
        //基础热量 + 重量系数*重量 + 身高系数*身高 - 年龄系数*年龄
        return $person->baseHot
                + ($person->weightRatio * $person->weight)
                + ($person->heightRatio * $person->height)
                - ($person->ageRatio * $person->age)
            ;
    }
    /**女人总消耗热量
     * @param Person $person
     * @return int
     */
    public function womanAction(Person $person)
    {
        return (int)($this->baseStatistic($person));
//        return (int)($this->baseStatistic($person) / static::$totalRitio);
    }

    /**男人总消耗热量
     * @param Person $person
     * @return int
     */
    public function manAction(Person $person)
    {
        return (int)($this->baseStatistic($person));
//        return (int)($this->baseStatistic($person) / static::$totalRitio);
    }
}
